<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="path" value="${pageContext.request.contextPath}"></c:set>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Password Change</title>

<script type="text/javascript" src="${path}/js/jquery-1.10.2.js"></script>
<link rel="stylesheet"
	href="${path}/js/validator-0.7.3/jquery.validator.css">
<script type="text/javascript"
	src="${path}/js/validator-0.7.3/jquery.validator.js"></script>
<script type="text/javascript"
	src="${path}/js/validator-0.7.3/local/zh_CN.js"></script>

<script src="${path}/js/jBox/jquery-1.4.2.min.js"></script>
<script	src="${path}/js/jBox/jquery.jBox-2.3.min.js"></script>
<script	src="${path}/js/jBox/i18n/jquery.jBox-zh-CN.js"></script>
<link type="text/css" rel="stylesheet" href="${path}/js/jBox/Skins/Green/jbox.css" />

<!-- BEGIN GLOBAL MANDATORY STYLES -->

<link href="${path}/css/basic/bootstrap.min.css" rel="stylesheet"
	type="text/css" />

<link href="${path}/css/basic/bootstrap-responsive.min.css"
	rel="stylesheet" type="text/css" />

<link href="${path}/css/basic/font-awesome.min.css" rel="stylesheet"
	type="text/css" />

<link href="${path}/css/basic/style-metro.css" rel="stylesheet"
	type="text/css" />

<link href="${path}/css/basic/style.css" rel="stylesheet"
	type="text/css" />

<link href="${path}/css/basic/style-responsive.css" rel="stylesheet"
	type="text/css" />

<link href="${path}/css/basic/default.css" rel="stylesheet"
	type="text/css" id="style_color" />

<link href="${path}/css/basic/uniform.default.css" rel="stylesheet"
	type="text/css" />

<!-- END GLOBAL MANDATORY STYLES -->

<script type="text/javascript">
	function checkPasswordAjax() {
		var mydata = '{"password":"' + $("#password").val() + '","password1":"'
				+ $("#password1").val() + '","password2":"'
				+ $("#password2").val() + '"}';
		//debugger;
		$.ajax({
			type : 'post',
			url : '/bms/readerinfo/passwordChange',
			data : mydata,
			dataType : 'json',
			contentType : "application/json; charset=utf8",
			success : function(result) {
				show(result);
			}
		});
	}
	function show(data) {
		if (data.oldEmpty != null) {
// 			$("#checkOld").html(data.oldEmpty);
			alert(data.oldEmpty);
			location.href="/bms/readerinfo/passwordChangeGoto";
// 			$.jBox.tip(data.oldEmpty);

		} else if (data.differ != null) {
// 			$("#checkNew").html(data.differ);
			alert(data.differ);
			location.href="/bms/readerinfo/passwordChangeGoto";
// 			$.jBox.tip('Please input your old password');

		} else {
			alert("success!");
		}
	}

	function checkpassword() {

		var password = document.getElementById("password").value;
		var password1 = document.getElementById("password1").value;
		var password2 = document.getElementById("password2").value;

		if (password == "" || password1 == "" || password2 == ""
				|| password1 != password2) {
			document.getElementById("sv").disabled = true;
			return;
		} else {
			document.getElementById("sv").disabled = false;
			return;
		}
	}
</script>
</head>
<body>

	<!-- BEGIN PAGE CONTAINER-->

	<div class="container-fluid">

		<!-- BEGIN PAGE HEADER-->

		<div class="row-fluid">

			<div class="span12">

				<!-- BEGIN PAGE TITLE & BREADCRUMB-->

				<h3 class="page-title">Password Change</h3>

				<ul class="breadcrumb">

					<li><i class="icon-home"></i> <a href="#">Home</a> <span
						class="icon-angle-right"></span></li>

					<li>Password Change</li>

				</ul>

				<!-- END PAGE TITLE & BREADCRUMB-->

			</div>

		</div>

		<!-- END PAGE HEADER-->

		<!-- BEGIN PAGE CONTENT-->

		<div class="row-fluid">

			<div class="span12">

				<!-- BEGIN SAMPLE FORM PORTLET-->

				<div class="portlet box green tabbable">

					<div class="portlet-title">

						<div class="caption">

							<i class="icon-reorder"></i>Password Change

						</div>

					</div>

					<div class="portlet-body form">

						<div class="tab-content">

							<!-- BEGIN FORM-->
							<form class="form-horizontal">
								<div class="control-group">
									<label class="control-label">Old Password:</label>
									<div class="controls">
										<input class="m-wrap medium" type="password" id="password"
											name="password" value="" placeholder="Enter Old Password"
											data-rule="required;" data-tip="Not Empty" />
									</div>
								</div>
								<div class="control-group">
									<label class="control-label">New Password:</label>
									<div class="controls">
										<input class="m-wrap medium" type="password" id="password1" maxlength="15"
											name="password1" value="" placeholder="Enter New Password"
											data-rule="required;" data-tip="Not Empty" />
									</div>
									<div id="checkNew1"></div>
								</div>
								<div class="control-group">
									<label class="control-label">Confirm Password:</label>
									<div class="controls">
										<input class="m-wrap medium" type="password" id="password2" maxlength="15"
											name="password2" value=""
											placeholder="Enter New Password Again"
											onblur="checkpassword();" data-rule="required;"
											data-tip="Not Empty"  />
									</div>
									<div id="checkNew2"></div>
									<div id="checkNew3"></div>
								</div>
								<div>
									<div class="form-actions">
<!-- 										<div id="checkOld" style="color: red"></div> -->
<!-- 										<div id="checkNew" style="color: red"></div> -->
										<button class="btn blue" name="queryB" id="sv" value="Remain"
											onclick="checkPasswordAjax();"  disabled>
											<i class="icon-ok"></i> Save
										</button>
									</div>
								</div>
							</form>
							<!-- END FORM-->

						</div>

					</div>

				</div>

				<!-- END SAMPLE FORM PORTLET-->

			</div>

		</div>

		<!-- END PAGE CONTENT-->

	</div>

	<!-- END PAGE CONTAINER-->


	<!-- BEGIN JAVASCRIPTS(Load javascripts at bottom, this will reduce page load time) -->

	<!-- BEGIN CORE PLUGINS -->

	<script src="${path}/js/basic/jquery-1.10.1.min.js"
		type="text/javascript"></script>

	<script src="${path}/js/basic/jquery-migrate-1.2.1.min.js"
		type="text/javascript"></script>

	<!-- IMPORTANT! Load jquery-ui-1.10.1.custom.min.js before bootstrap.min.js to fix bootstrap tooltip conflict with jquery ui tooltip -->

	<script src="${path}/js/basic/jquery-ui-1.10.1.custom.min.js"
		type="text/javascript"></script>

	<script src="${path}/js/basic/bootstrap.min.js" type="text/javascript"></script>

	<!--[if lt IE 9]>

	<script src="${path}/js/basic/excanvas.min.js"></script>

	<script src="${path}/js/basic/respond.min.js"></script>  

	<![endif]-->

	<script src="${path}/js/basic/jquery.slimscroll.min.js"
		type="text/javascript"></script>

	<script src="${path}/js/basic/jquery.blockui.min.js"
		type="text/javascript"></script>

	<script src="${path}/js/basic/jquery.cookie.min.js"
		type="text/javascript"></script>

	<script src="${path}/js/basic/jquery.uniform.min.js"
		type="text/javascript"></script>

	<script src="${path}/js/basic/app.js"></script>

	<script>
		jQuery(document).ready(function() {

			// initiate layout and plugins

			App.init();

		});
	</script>

	<!-- END JAVASCRIPTS -->

</body>
</html>